using System; 
using System.Collections.Generic; 
using System.Text; 
using FluentNHibernate.Mapping;

namespace SHKurzy.Domain
{
    public class OsobyMap : ClassMap<Osoba>
    {
        public OsobyMap()
        {
            Table("Osoby");
            LazyLoad();
            Id(x => x.ID).GeneratedBy.Identity().Column("ID");
            References(x => x.Staty).Column("StatID");
            References(x => x.Obrazky).Column("FotoID");
            Map(x => x.Jmeno).Column("Jmeno").Length(50);
            Map(x => x.Prijmeni).Column("Prijmeni").Length(50);
            Map(x => x.Titul).Column("Titul").Length(30);
            Map(x => x.TitulZa).Column("TitulZa").Length(30);
            Map(x => x.RC).Column("RC").Length(11);
            Map(x => x.Ulice).Column("Ulice").Length(50);
            Map(x => x.Cislo).Column("Cislo").Length(10);
            Map(x => x.Mesto).Column("Mesto").Length(50);
            Map(x => x.PSC).Column("PSC").Length(10);
            Map(x => x.Telefon).Column("Telefon").Length(50);
            Map(x => x.Email).Column("Email").Length(50);
            Map(x => x.Poznamka).Column("Poznamka").Length(2147483647);
            Map(x => x.Vedouci).Column("Vedouci").Length(1);
            Map(x => x.OldID).Column("OldID").Length(8);
            Map(x => x.OldIDKurzy).Column("OldIDKurzy").Length(8);
            Map(x => x.Osloveni).Column("Osloveni").Length(50);
            HasMany(x => x.KurzySet).KeyColumn("VedouciID");
            HasMany(x => x.OsobyNaKurzuSet).KeyColumn("OsobaID");
        }
    }
}